<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" /> 
<title>订单支付</title>
<script src="/Public/Home/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
var order_sn = "<?php echo ($res['order_sn']); ?>";
//调用微信JS api 支付
function jsApiCall(){
	WeixinJSBridge.invoke(
		'getBrandWCPayRequest',
		<?php echo $jsApiParameters; ?>,
		function(res){
			//如果支付成功
			if (res.err_msg == 'get_brand_wcpay_request:ok') {
				//支付成功后跳转的地址
				//location.href = '';
				hideSomeTag();
	
			}else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
				alert('请尽快完成支付哦！');
			}else if (res.err_msg == 'get_brand_wcpay_request:fail') {
				alert(JSON.stringify(res));
				alert('支付失败');
			}else {
				alert('意外错误');
			}
			//WeixinJSBridge.log(res.err_msg);
			//alert(res.err_code+res.err_desc+res.err_msg);
			/*if (res.err_msg == 'get_brand_wcpay_request:ok') {
				alert('支付成功');
			}else {
				alert('取消支付');
			}*/
		}
	);
}
function callpay(){

	if (typeof WeixinJSBridge == "undefined"){
	    if( document.addEventListener ){
	        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
	    }else if (document.attachEvent){
	        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
	        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
	    }
	}else{
	    jsApiCall();
	}
}
function redirectToIndex(){
	location.href='/';
}

function hideSomeTag(){
	$('.payment').css('display','none');
	$('.wxpay_1').show();
	$('.wxpay').css('display','none');
	$('h2').text('支付成功');
}
</script>
<style type="text/css">
*{
	padding: 0;
	margin:0;
	font-family: "Helvetica Neue",Helvetica,sans-serif;
}
	.flowpay h2{
		width:100%;
		height:40px;
		line-height: 40px;
		color: #fff;
		text-align: center;
		background: green;
		font-size: 14px;

	}
.payment{
	color:#000;
	width: 100%;
	/* height: 40px; */
	text-align: center;
	line-height: 40px;
	margin-top: 20px;
	font-size: 14px;
}
.price{
	color: red;
	font-size: 25px;
}
.wxpay{
	margin-top: 40px;
	width: 90%;
	margin-left: 5%;
	margin-right: 5%;
	background: green;
	text-align: center;
	height: 40px;
	line-height: 40px;
	border: none;
	color: #fff;
	font-size:16px;
	font-weight: bold;
	border-radius: 3px;
}

.wxpay_1{
	margin-top: 40px;
	width: 90%;
	margin-left: 5%;
	margin-right: 5%;
	background: red;
	text-align: center;
	height: 40px;
	line-height: 40px;
	border: none;
	color: #fff;
	font-size:16px;
	font-weight: bold;
	border-radius: 10px;
	display: none;
}
</style>
</head>
 <body style="height:100%;background:#eee;"> <!-- onload="callpay()" -->
<!--头部开始-->
<div class="flowpay">
	<h2 style="position: relative;"><span onclick="window.history.go(-1);" style="position: absolute;left: 5%;font-family: '宋体';font-size: 20px;width: 30px;text-align: center;">&lt;</span>确认交易</h2>
	<dl>
		<dd class="payment" style="font-weight: bold;">
			<strong><?php echo ($res['activity_name']); ?></strong>
		</dd>
		<dd class="payment" style="margin-top: 0;height: auto;">
			本次订单需支付：<strong class="price" style="color:#000;font-size:40px;display: block;">¥<?php echo ($res['order_amount']); ?></strong>
		</dd>
		<dd style="background: #FFF; padding: 10px;line-height: 30px; border-top: #ccc 1px solid;color: #999;margin-top: 20px;border-bottom: #ccc 1px solid;">收款方<span style="float: right;color: #333;">广东省国防教育学会</span></dd>
		<dd>
			<input class="wxpay" type="button" value="微信支付" onclick="callpay();" />
			<input type="button" class="wxpay_1"value="支付成功返回首页" onclick="redirectToIndex();" />
		</dd>
	</dl>
</div>
<!--尾结束-->
</body>
</html>